import request from '@/utils/request'

// 查询工程计量列表
export function listMeterage(query) {
  return request({
    url: '/engineering/meterage/list',
    method: 'get',
    params: query
  })
}

// 查询工程计量详细
export function getMeterage(masterId) {
  return request({
    url: '/engineering/meterage/' + masterId,
    method: 'get'
  })
}

// 查询小数点位数
export function getDecimalPlace(masterId) {
  return request({
    url: '/engineering/meterage/getDecimalPlace/' + masterId,
    method: 'get'
  })
}

// 新增工程计量
export function addMeterage(data) {
  return request({
    url: '/engineering/meterage',
    method: 'post',
    data: data
  })
}

// 修改工程计量
export function updateMeterage(data) {
  return request({
    url: '/engineering/meterage',
    method: 'put',
    data: data
  })
}

// 删除工程计量
export function delMeterage(masterId) {
  return request({
    url: '/engineering/meterage/' + masterId,
    method: 'delete'
  })
}

// 传送工程计量
export function deliveryMeterage(data) {
  return request({
    url: '/engineering/meterage/delivery',
    method: 'post',
    data: data
  })
}

// 锁定工程计量
export function lockMeterage(masterId) {
  return request({
    url: '/engineering/meterage/lock/' + masterId,
    method: 'get'
  })
}

// 解锁工程计量
export function unLockMeterage(masterId) {
  return request({
    url: '/engineering/meterage/unlock/' + masterId,
    method: 'get'
  })
}

// 工程计量添加前的验证
export function beforeAddValidate() {
  return request({
    url: '/engineering/meterage/validateBeforeMeterageIsWorkflowUser',
    method: 'get'
  })
}
